﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sparkle.Demo.Model;
using Sparkle.MVVM;
using Sparkle.UI;
using Sparkle.Hosting;

namespace Sparkle.Wpf.Demo.UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class Shell : Window, IShell
    {
        public Shell()
        {
            InitializeComponent();
            Defaults.Shell = this;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Hosting.HostingPanel.DefaultHostingPanel = MainHostingPanel;
            Hosting.HostingPanel.DefaultHostingPanel.LinkPanels.Add(QuickLinkMenu);
            Hosting.HostingPanel.DefaultHostingPanel.LinkPanels.Add(ReportLinkMenu);
            Hosting.HostingPanel.DefaultHostingPanel.LinkPanels.Add(LinkedFileMenu);
            Hosting.HostingPanel.DefaultHostingPanel.LinkPanels.Add(LinkedLocalReportMenu);
            Hosting.HostingPanel.DefaultHostingPanel.LinkPanels.Add(LinkQuickNote);

            QuickLinkMenu.OnLinkClick += new LinkHandler(QuickLinkMenu_OnLinkClick);
            ReportLinkMenu.OnLinkClick += new LinkHandler(ReportLinkMenu_OnLinkClick);
            LinkQuickNote.OnLinkClick += new LinkHandler(ReportLinkMenu_OnLinkClick);
            LinkedFileMenu.OnLinkClick += new LinkHandler(ReportLinkMenu_OnLinkClick);
            LinkedLocalReportMenu.OnLinkClick += new LinkHandler(ReportLinkMenu_OnLinkClick);

            PersonControl personControl = new PersonControl() { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch };

            Sparkle.Hosting.HostingPanel.HostControl(personControl);
        }

        void ReportLinkMenu_OnLinkClick(object sender, object entity)
        {
            ReportClient.ReportControl reportcontrol = new ReportClient.ReportControl { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch };
            Hosting.HostingPanel.HostControl(reportcontrol);
        }

        void QuickLinkMenu_OnLinkClick(object sender, object entity)
        {
            ;
        }

        public IHostingPanel HostingPanel
        {
            get { return this.MainHostingPanel; }
        }

        public IPopup Popup
        {
            get { return _myPopup; }
        }
    }
}
